const _appSessionInfo = reactive({} as AppSessionInfoType);

// APP当前会话全局信息,全局状态
export const AppSessionInfo = {
	// 计算属性，返回当前的 APP 信息
	appSessionInfo: computed(() => {
		return _appSessionInfo;
	}),
	// 设置强密码配置信息
	// @param {boolean} strongPassword - 是否启用强密码
	// @param {string} passwordStrengthValidation - 密码强度验证规则
	setStrongPasswordConfig: (strongPassword: boolean, passwordStrengthValidation: string, PasswordStrengthValidationMsg: string) => {
		_appSessionInfo.strongPassword = strongPassword;
		_appSessionInfo.passwordStrengthValidation = passwordStrengthValidation;
		_appSessionInfo.passwordStrengthValidationMsg = PasswordStrengthValidationMsg;
	},
	// 设置当前密码是否为强密码
	// @param {boolean} isStrong - 当前密码是否为强密码
	setcurrentPasswordIsStrong: (password: string) => {
		const regex = new RegExp(_appSessionInfo.passwordStrengthValidation);
		_appSessionInfo.currentPasswordIsStrong = regex.test(password);
	},
};
